{extend name="pub/base2" /}
{block name="title"}
<title>留言回复</title>
{/block}

{block name="body"}
<article class="clearfix pd-20">
    <form method="post" class="form form-horizontal">
        <div class="row clearfix">
            <img style="width: 70px;height: auto;" class="form-label col-xs-4 col-sm-3" src="/static/images/mrtx.gif"
                 alt="">
            <div class="formControls col-xs-8 col-sm-9">
                {$msg.content}
            </div>
        </div>

        {volist name="replys" id="vo"}
        <div class="row clearfix">
            <img style="width: 70px;height: auto;" class="form-label col-xs-4 col-sm-3"
                 src="/static/images/{$vo.uid==-1?'admin.png':'mrtx.gif'}">
            <div class="formControls col-xs-8 col-sm-9">
                {$vo.content}
            </div>
        </div>
        {/volist}
        <br>
        <hr>
        <br>
        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">回复：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="content" cols="" rows="10" class="textarea" dragonfly="true"
                          onKeyUp="textarealength(this,100)"></textarea>
            </div>
        </div>

        <input type="hidden" value="{$msg.id}" name="id">

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function(){
        $("form").validate({
            rules:{
                content:{
                    required:true
                }
            },
            onkeyup:false,
            focusCleanup:false,
            submitHandler: function(form) {
                $.ajax({
                    url:"{:url('reply')}",
                    type:'post',
                    data:$('form').serialize(),
                    success(res) {
                        if (res.err == 0) {
                            layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                                window.location.reload();
                            });
                        } else {
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    }
                })
            }
        });
    });
</script>
{/block}